package com.test.dao.impl;

import com.test.dao.IBuildValveDao;
import com.test.model.BuildValve;
import com.test.model.House;
import org.hibernate.Query;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by ZZF on 2017/7/27.
 */
@Service
public class BuildValveDaoImpl extends BaseDaoImpl<BuildValve> implements IBuildValveDao {

    @Override
    public List<House> findHouses(int unitId) {

        String sql="SELECT c.* FROM `rcc_e_buildvalve` a  INNER JOIN g_house c ON c.unitId=a.unitId " +
                "WHERE a.unitId="+unitId;

        Query query = getSession().createSQLQuery(sql).addEntity(House.class);

        return query.list();
    }
}
